package t4tools.etodo.model;

import java.util.ArrayList;
import java.util.List;

import t4tools.etodo.enums.TreeViewElementType;

public class Category extends AbstractTreeElement {

	private Category parent;
	private List<TreeElement> children = new ArrayList<TreeElement>();

	public Category(String name, Category parent) {
		super(name, TreeViewElementType.CATEGORY);
		this.parent = parent;
		if (parent != null) {
			// root node has no parent
			parent.getChildren().add(this);
		}
	}

	@Override
	public TreeElement getParent() {
		return parent;
	}

	@Override
	public List<TreeElement> getChildren() {
		return children;
	}

	@Override
	public boolean hasChildrent() {
		return getChildren() != null && !getChildren().isEmpty();
	}

}
